package com.ggb.reactive.domain.entity

import com.fasterxml.jackson.annotation.JsonFormat
import io.swagger.v3.oas.annotations.media.Schema
import lombok.AllArgsConstructor
import lombok.Builder
import lombok.Data
import lombok.NoArgsConstructor
import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table
import java.math.BigDecimal
import java.time.Instant


@Table("orders")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(title="订单实体 Orders")

data class Orders(
    @Id
    var id: Long? = null,
    @Schema(description = "订单号")
    var number: String? = null,
    @Schema(description = "订单状态 1待付款 2待接单 3已接单 4派送中 5已完成 6已取消 7退款")
    var status: Int? = null,
    @Schema(description = "下单用户id")
    var userId: Long? = null,
    @Schema(description = "地址id")
    var addressBookId: Long? = null,
    @Schema(description = "支付状态 0未支付 1已支付 2退款")
    var payStatus: Int? = null,
    @Schema(description = "支付方式 1微信，2支付宝")
    var payMethod: Int? = null,
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-6")
    @Schema(description = "下单时间")
    var orderTime: Instant? = null,
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-6")
    @Schema(description = "结账时间")
    var checkoutTime: Instant? = null,
    @Schema(description = "实收金额")
    var amount: BigDecimal? = null,
    @Schema(description = "备注")
    var remark: String? = null,
    @Schema(description = "用户名")
    var userName: String? = null,
    @Schema(description = "phone")
    var phone: String? = null,
    @Schema(description = "地址")
    var address: String? = null,
    @Schema(description = "收货人")
    var consignee: String? = null,
    @Schema(description = "订单取消原因")
    var cancelReason: String? = null,
    @Schema(description = "订单拒绝原因")
    var rejectionReason: String? = null,
    @Schema(description = "订单取消时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-6")
    var cancelTime: Instant? = null,
    @Schema(description = "预计送达时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var estimatedDeliveryTime: Instant? = null,
    @Schema(description = "配送状态  1立即送出  0选择具体时间")
    var deliveryStatus: Int? = null,
    @Schema(description = "送达时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-6")
    var deliveryTime: Instant? = null,
    @Schema(description = "打包费")
    var packAmount: Int? = null,
    @Schema(description = "餐具数量")
    var tablewareNumber: Int? = null,
    @Schema(description = "餐具数量状态  1按餐量提供  0选择具体数量")
    var tablewareStatus: Int? = null,
)
